#include "scenariogeneratortest.h"

/*Registry this TestSuite to theTestFactoryRegistry*/
CPPUNIT_TEST_SUITE_REGISTRATION (ScenarioGeneratorTest);

void ScenarioGeneratorTest::setUp() {
	SG_init();
	
}

void ScenarioGeneratorTest::testMakeScenarioFromDescription() { fprintf(stderr,">>> ScenarioGeneratorTest::testMakeScenarioFromDescription()\n");
	ScenarioGenerator *scenegen = ScenarioGenerator::getInstance();
		
	Scenario *scene = scenegen->makeScenarioFromDescription("../data/unittest.xml");
	
	scene->writeToXML("../data/unittest_result.xml");
	
	//Some tests
	CPPUNIT_ASSERT_EQUAL(scene->getJob()->getNumberOfTasks(), 10);
	CPPUNIT_ASSERT(!strcmp(scene->getJob()->getTaskByIndex(2)->getName(), "task_3"));

	delete scenegen;
	delete scene;
	
}

void ScenarioGeneratorTest::testMakeScenarioFromModel() { fprintf(stderr,">>> ScenarioGeneratorTest::testMakeScenarioFromModel()\n");
	ScenarioGenerator *scenegen = ScenarioGenerator::getInstance();
		
	Scenario *scene1 = scenegen->makeScenarioFromModel("../data/model.xml");	

	scene1->writeToXML("../data/scene1FromModel.xml");	

	delete scenegen;	
	delete scene1;	

	
}
void ScenarioGeneratorTest::tearDown() {
	SG_clear();
}

